home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
dvc_cntl
/
receipt
/
reciept1.bas
< prev
next >
Wrap
BASIC Source File
|
1993-07-22
|
3KB
|
116 lines
Sub CalcTotals ()
Dim SubTotal As Double
Dim Tax As Double
Dim Freight As Double
Dim GrandTotal As Double
Dim Deposit As Double
Dim Balance As Double
For i% = 1 To NumItems ' Calc Ext's
Form2.Grid1.Col = 0
Form2.Grid1.Row = i%
Qty = Val(Form2.Grid1.text)
Form2.Grid1.Col = 4
Price = Val(Form2.Grid1.text)
Form2.Grid1.Col = 5
Form2.Grid1.text = Format$(Qty * Price, "####.00")
Next i%
SubTotal = 0 ' Calc SubTotal
For i% = 1 To NumItems
Form2.Grid1.Row = i%
SubTotal = SubTotal + Val(Form2.Grid1.text)
Next i%
Tax = SubTotal * SalesTax ' Calc Sales Tax
Form2.Grid2.Col = 1
Form2.Grid2.Row = 2
Freight = Val(Form2.Grid2.text)
GrandTotal = SubTotal + Tax + Freight
Form2.Grid2.Row = 4
Deposit = Val(Form2.Grid2.text)
Balance = GrandTotal - Deposit
Form2.Grid2.Row = 0
Form2.Grid2.text = Format$(SubTotal, "$####.00")
Form2.Grid2.Row = 1
Form2.Grid2.text = Format$(Tax, "$####.00")
Form2.Grid2.Row = 3
Form2.Grid2.text = Format$(GrandTotal, "$####.00")
Form2.Grid2.Row = 5
Form2.Grid2.text = Format$(Balance, "$####.00")
End Sub
Function CheckDate% (Src As Control)
Flag = 0
Mnth% = Val(Mid$(Src.text, 1, 2))
Daye% = Val(Mid$(Src.text, 4, 2))
yr% = Val(Mid$(Src.text, 7, 2))
If Mnth% < 1 Or Mnth% > 12 Then Flag = -1
If Daye% < 1 Or Daye% > 31 Then Flag = -1
If yr% < 0 Or yr% > 99 Then Flag = -1
tmp$ = Mid$(Src.text, 3, 1)
If tmp$ <> "/" And tmp$ <> "-" Then Flag = -1
tmp$ = Mid$(Src.text, 6, 1)
If tmp$ <> "/" And tmp$ <> "-" Then Flag = -1
CheckDate% = Flag
End Function
Sub CompressItems ()
' this routine checks the Grid1 entries and if it
' finds an empty entry, will compress the listing
' to eliminate holes in the entries...
End Sub
' COPYRIGHT:
'
' (C) Copyright Microsoft Corp. 1993. All rights reserved.
'
' You have a royalty-free right to use, modify, reproduce and
' distribute the Sample Files (and/or any modified version) in
' any way you find useful, provided that you agree that
' Microsoft has no warranty obligations or liability for any
' Sample Application Files which are modified.
'
Sub InitVars ()
Form1.VenName.text = ""
Form1.VenNo.text = ""
Form1.CalledIn.text = ""
Form1.OrderDate.text = " / /"
Form1.VenContact.text = ""
Form1.EstDate.text = " / /"
Form1.CustName.text = ""
Form1.CustAddr.text = ""
Form1.CustCity.text = ""
Form1.CustState.text = ""
Form1.CustZip.text = ""
Form1.HPhone.text = "( ) - "
Form1.WPhone.text = "( ) - "
Form1.ShipName.text = ""
Form1.ShipAddr.text = ""
Form1.ShipCity.text = ""
Form1.ShipState.text = ""
Form1.ShipZip.text = ""
Form1.ShipVia.text = ""
Form1.Terms.text = ""
NumItems = 0
Form1.OrderNo.text = LTrim$(Str$(Val(Form1.OrderNo.text) + 1))
End Sub
Sub SaveInfo ()
End Sub